<div class="container">
    <h1 id="pkg-overview">package user</h1>
    <p><code>import "os/user"</code>
    </p><p>user包允许通过名称或ID查询用户帐户。</p>
    
    
		
        
        
        
        
        
        
    
    <h2 id="UnknownUserError">type <a href="https://github.com/golang/go/blob/master/src/os/user/user.go?name=release#39" title="View Source">UnknownUserError</a> </h2>
    <pre>type UnknownUserError <a href="builtin.htm#string">string</a></pre>
    <p>当找不到用户时，Lookup会返回UnknownUserError</p>
    <h3 id="UnknownUserError.Error">func (UnknownUserError) <a href="https://github.com/golang/go/blob/master/src/os/user/user.go?name=release#41" title="View Source">Error</a> </h3>
    <pre class="funcdecl">func (e <a href="#UnknownUserError">UnknownUserError</a>) Error() <a href="builtin.htm#string">string</a></pre>
    <h2 id="UnknownUserIdError">type <a href="https://github.com/golang/go/blob/master/src/os/user/user.go?name=release#31" title="View Source">UnknownUserIdError</a> </h2>
    <pre>type UnknownUserIdError <a href="builtin.htm#int">int</a></pre>
    <p>当找不到用户时，LookupId会返回UnknownUserIdError</p>
    <h3 id="UnknownUserIdError.Error">func (UnknownUserIdError) <a href="https://github.com/golang/go/blob/master/src/os/user/user.go?name=release#33" title="View Source">Error</a> </h3>
    <pre class="funcdecl">func (e <a href="#UnknownUserIdError">UnknownUserIdError</a>) Error() <a href="builtin.htm#string">string</a></pre>
    <h2 id="User">type <a href="https://github.com/golang/go/blob/master/src/os/user/user.go?name=release#21" title="View Source">User</a> </h2>
    <pre>type User struct {
    <span id="User.Uid">Uid</span>      <a href="builtin.htm#string">string</a> <span class="com">// 用户ID</span>
    <span id="User.Gid">Gid</span>      <a href="builtin.htm#string">string</a> <span class="com">// 初级组ID</span>
    <span id="User.Username">Username</span> <a href="builtin.htm#string">string</a>
    <span id="User.Name">Name</span>     <a href="builtin.htm#string">string</a>
    <span id="User.HomeDir">HomeDir</span>  <a href="builtin.htm#string">string</a>
}</pre>
    <p align="left">User代表一个用户帐户。</p>
    <p align="left">在posix系统中Uid和Gid字段分别包含代表uid和gid的十进制数字。在windows系统中Uid和Gid包含字符串格式的安全标识符（SID）。在Plan 9系统中，Uid、Gid、Username和Name字段是/dev/user的内容。</p>
    <h3 id="Current">func <a href="https://github.com/golang/go/blob/master/src/os/user/lookup.go?name=release#8" title="View Source">Current</a> </h3>
    <pre class="funcdecl">func Current() (*<a href="#User">User</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>返回当前的用户帐户。</p>
    <h3 id="Lookup">func <a href="https://github.com/golang/go/blob/master/src/os/user/lookup.go?name=release#14" title="View Source">Lookup</a> </h3>
    <pre class="funcdecl">func Lookup(username <a href="builtin.htm#string">string</a>) (*<a href="#User">User</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>根据用户名查询用户。</p>
    <h3 id="LookupId">func <a href="https://github.com/golang/go/blob/master/src/os/user/lookup.go?name=release#20" title="View Source">LookupId</a> </h3>
    <pre class="funcdecl">func LookupId(uid <a href="builtin.htm#string">string</a>) (*<a href="#User">User</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>根据用户ID查询用户。</p>
</div>